package com.lzh.others.java8.book.chapter_3_3常用流操作;

import java.util.ArrayList;
import java.util.Set;
import java.util.stream.Collectors;

public class FInal {
    public static void main(String[] args) {
        Album album = new Album(new ArrayList<Singer>() {{
            add(new Singer("The Bank 1", "A"));
            add(new Singer("The Bank 2", "A"));
            add(new Singer("The Bank 3", "B"));
            add(new Singer("The Bank 4", "C"));
            add(new Singer("Rick", "A"));
            add(new Singer("Los", "B"));
        }});

        Set<String> the = album.getMusiciansByStream()
                .filter(singer -> singer.getName().startsWith("The"))
                .map(Singer::getNationality)
                .collect(Collectors.toSet());
        System.out.println("the = " + the);

    }
}
